const Koa = require('koa');
const views = require('koa-views');
const path = require('path');
const app  = new Koa();

app.use(views(path.join(__dirname,'./view'),{
    extension: 'ejs'
}));

app.use(async (ctx) => {
    let title = 'Hello Xgp';
    await ctx.render('index',{
        title
    });
});

// 监听端口
app.listen(3000,() => {
    //监听回调
    console.log('app is start at port 3000');
});
